package com.whj.homework.controller;

import com.whj.homework.login.LoginType;
import com.whj.homework.pojo.User;
import com.whj.homework.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/homework")
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping(value = "/login",method = {RequestMethod.GET,RequestMethod.POST})
    public LoginType login(
            @RequestBody
            User user,
            HttpSession session
    ){
        return this.userService.login(user,session);
    }
}
